<template>
	<view class="comment-container">
		<view class="song-box">
			<view class="song-left">
				<view class="xiex-image">
					<xiex-image :src = "nowSong.image"></xiex-image>
				</view>
				<view class="title-author">
					<p>{{nowSong.title}}</p>
					<p>{{nowSong.author}}</p>
				</view>
			</view>
			<i style="line-height: 140rpx;">123</i>
		</view>
		<view class="comment">
			<h5 class="comment-title">
				评论区
			</h5>
			<view class="comment-box" v-for="item in hotComments" :key="item.commentId">
				<view class="xiex-image">
					<xiex-image :src="item.user.avatarUrl"></xiex-image>
				</view>
				<view class="comment-content">
					<view class="title">
						<view>
							<p>{{item.user.nickname}}</p>
							<p>{{item.time}}</p>
						</view>
						<view>{{item.likedCount}}赞</view>
					</view>
					<view class="content">
						{{item.content}}
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hotComments: []
			}
		},
		computed:{
			nowSong(){
				return this.$store.getters.songData
			}
		},
		onLoad() {
			this.getComments();
			console.log(this.nowSong);
		},
		methods: {
			getComments(){
				uni.request({
					url: 'http://119.3.174.206:3000/comment/hot?type=0&id='+this.nowSong.id,
					success: (res) => {
						console.log('评论',res)
						this.hotComments = res.data.hotComments
					},
					fail: (msg) => {
						console.log(msg);
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.comment-container {
		background-color: #eee;
		height: 100%;
		.song-box {
			display: flex;
			justify-content: space-between;
			padding: 20rpx 15rpx;
			background-color: #fff;
		}
			.song-left {
			display: flex;
			.xiex-image {
				height: 140rpx;
				width: 140rpx;
				background-color: pink;
				overflow: hidden;
				border-radius: 50%;
			}
			.title-author {
				padding-top: 15rpx;
				margin-left: 15rpx;
				// align-items: center;
			}
			}
		.comment {
			margin-top: 15rpx;
			background-color: #fff;
			.comment-title {
				padding: 20rpx 30rpx;
			}
			.comment-box {
				display: flex;
				// justify-content: space-between;
				font-size: 28rpx;
				.xiex-image {
					margin: 25rpx 0 0 20rpx;
					height: 60rpx;
					width: 60rpx;
					border-radius: 50%;
					overflow: hidden;
				}
				.comment-content {
					// margin-left: 15rpx;
					width: 640rpx;
					padding: 10rpx 10rpx 20rpx 10rpx;
					border-bottom: .5rpx solid #eee;
					.title {
						display: flex;
						justify-content: space-between;
						padding-bottom: 10rpx;
					}
					.content {
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>
